providers.tsx 1.3 KB

1234567891011121314151617181920212223242526272829303132
  1. import { useFlag } from 'common'
  2. import { PageContainer } from 'ui-patterns/PageContainer'
  3. import { AuthProvidersForm } from '@/components/interfaces/Auth/AuthProvidersForm'
  4. import { BasicAuthSettingsForm } from '@/components/interfaces/Auth/BasicAuthSettingsForm'
  5. import { CustomAuthProviders } from '@/components/interfaces/Auth/CustomAuthProviders'
  6. import { AuthProvidersLayout } from '@/components/layouts/AuthLayout/AuthProvidersLayout'
  7. import DefaultLayout from '@/components/layouts/DefaultLayout'
  8. import { useIsFeatureEnabled } from '@/hooks/misc/useIsFeatureEnabled'
  9. import type { NextPageWithLayout } from '@/types'
  10. const ProvidersPage: NextPageWithLayout = () => {
  11. const showProviders = useIsFeatureEnabled('authentication:show_providers')
  12. const showCustomProviders = useIsFeatureEnabled('authentication:show_custom_providers')
  13. const isOauthProvidersEnabled = useFlag('CustomOauthProviders')
  14. return (
  15. <PageContainer size="default">
  16. <BasicAuthSettingsForm />
  17. {showProviders && <AuthProvidersForm />}
  18. {showCustomProviders && isOauthProvidersEnabled && <CustomAuthProviders />}
  19. </PageContainer>
  20. )
  21. }
  22. ProvidersPage.getLayout = (page) => (
  23. <DefaultLayout>
  24. <AuthProvidersLayout>{page}</AuthProvidersLayout>
  25. </DefaultLayout>
  26. )
  27. export default ProvidersPage